#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int N = 0;
    int arr[50] = { 0 };
    int del = 0;
    scanf("%d", &N);

    for (int i = 0; i < N; i++)
    {
        scanf("%d ", arr + i);
    }

    scanf("%d", &del);

    int count = 0;
    for (int i = 0; i < N; i++)
    {
        if (arr[i] == del)
        {
            count++;
            int j = i;
            while (j < N - 1)
            {
                arr[j] = arr[j + 1];
                arr[j + 1] = 0;
                j++;
            }
            i--;
        }
    }

    for (int i = 0; i < N - count; i++)
    {
        printf("%d ", arr[i]);
    }
    printf("\n");

    return 0;
}